·
<#import '/ftlLibrary/properteisVariable.ftl' as pv/>
<link rel="stylesheet" href="assets/css/skins/table.css">
<div class="col-lg-12 col-sm-12 col-xs-12">
    <div class="modal-header">
        <button type="button" class="bootbox-close-button close" data-dismiss="modal" aria-hidden="true">×</button>
        <h4 class="modal-title">${(editModel=='add')?string('新增亲子会员','编辑亲子会员')}</h4>
    </div>
    <div class="modal-body" style="padding-top: 0px!important">
        <input  name="memberType" id="memberType" value="${memberType}">
        <div class="row modalTitle" style="text-align: center;padding-top: 1px;min-height: 56px">
            <div class="col-xs-6 col-xs-offset-3">
                <div class="col-xs-6 nopadding">
                    <button type="btn" class="btn col-xs-12 basicInfoBtn"
                            style="border-color: #5db2ff!important;background-color: #5db2ff">基础信息
                    </button>
                </div>
                <div class="col-xs-6 nopadding">
                    <button type="btn" class="btn col-xs-12 ancedInfoBtn" style="border-color: #5db2ff!important;">
                        高级信息
                    </button>
                </div>
            </div>
        </div>
        <div class="row">
            <form class="editForm" action="${saveUrl}" method="post" responseType="JSON" role="form"
                  id="editForm_${serializeNum}"
                  data-bv-submitButtons="#editFormSubmitBtn_${serializeNum}"
                  data-bv-message="This value is not valid"
                  data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
                  data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
                  data-bv-feedbackicons-validating="glyphicon glyphicon-refresh">
                <input type="hidden" name="id" value="${editEntity.id}">
                <input type="hidden" name="memberType" id="memberType" value="${memberType}">
                <div class="member">
                    <#if memberType==1||memberType==2>
                        <#if (true && editModel=='add')||(true && editModel=='edit')>
                            <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-20">
                                <div class="form-group">
                                    <label for="name" class="col-sm-2 col-sm-offset-2 control-label no-padding-right">会员编号：</label>
                                    <div class="col-sm-6">
                                        <input data-bv-message="The field is not valid" size="12" name="number"
                                               alt="会员编号" id="" placeholder="会员编号" type="text" title="会员编号"
                                               class="form-control" value="${editEntity.number}"/>
                                        <span class="text"></span>
                                    </div>
                                </div>
                            </div>
                        </#if>
                    </#if>

                    <#if (true && editModel=='add')||(true && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-20">
                            <div class="form-group">
                                <label for="name"
                                       class="col-sm-2 col-sm-offset-2 control-label no-padding-right"><span
                                        style="color: red">*</span>客户姓名：</label>
                                <div class="col-sm-6">
                                    <input data-bv-message="The field is not valid" size="12" name="name" alt="客户姓名"
                                           id="name" placeholder="客户姓名" type="text" title="客户姓名" class="form-control"
                                           value="${editEntity.name}"/>
                                    <span class="text"></span>
                                </div>
                            </div>
                        </div>
                    </#if>
                    <#if (true && editModel=='add')||(true && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-20">
                            <div class="form-group">
                                <label for="nickName"
                                       class="col-sm-2 col-sm-offset-2 control-label no-padding-right">昵&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称：</label>
                                <div class="col-sm-6">
                                    <input data-bv-message="The field is not valid" size="50" name="nickName" alt="昵称"
                                           id="nickName" placeholder="昵称" type="text" title="昵称" class="form-control"
                                           value="${editEntity.nickName}"/>
                                    <span class="text"></span>
                                </div>
                            </div>
                        </div>
                    </#if>
                    <#if (true && editModel=='add')||(true && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-20">
                            <div class="form-group">
                                <label class="col-sm-2 col-sm-offset-2 control-label no-padding-right">性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别：</label>
                                <div class="col-sm-6">
                                    <label class="margin-right-20">
                                        <input type="radio" name="sex" value="1" checked="checked">
                                        <span class="text" style="margin-top:6px">男</span>
                                    </label>
                                    <label>
                                        <input type="radio" name="sex" value="2">
                                        <span class="text" style="margin-top:6px">女</span>
                                    </label>
                                </div>
                            </div>
                        </div>
                    </#if>
                    <#if (true && editModel=='add')||(true && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-20">
                            <div class="form-group">
                                <label for="birthdayDate"
                                       class="col-sm-2 col-sm-offset-2 control-label no-padding-right"><span
                                        style="color: red">*</span>生&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;日：</label>
                                <div class="col-sm-6">
										<span class="input-icon icon-left">
											<input data-bv-date-format="YYYY-MM-DD"
                                                   data-bv-message="The field is not valid"
                                                   data-bv-date-message="请正确输入一个时间" data-bv-date="true" size="10"
                                                   name="birthdayDate" alt="出生日期" id="birthdayDate" placeholder="出生日期"
                                                   type="text" title="出生日期"
                                                   class="form-control form-control date-picker"
                                                   onfocus="WdatePicker({doubleCalendar:true,dateFmt:'yyyy-MM-dd'})"
                                                   value="${editEntity.birthdayDate}"/>
											<i class="fa fa-calendar"></i>
										</span>
                                </div>
                            </div>
                        </div>
                    </#if>
                    <#if (true && editModel=='add')||(true && editModel=='edit')>
                        <#if relationList?size==0>
                            <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-20 circleHtml">
                                <input type="hidden" name="relationId" value="${data.id}">
                                <div class="form-group">
                                    <label for="contactPhone"
                                           class="col-sm-2 col-sm-offset-2 control-label no-padding-right"><span
                                            style="color: red">*</span>家长姓名：</label>
                                    <div class="col-sm-8">
                                        <label>
                                            <input required="required" data-bv-message="请填写客户信息！" maxlength="12"
                                                   name="patriarchName"
                                                   alt="联系电话" id="patriarchName" placeholder="家长姓名" type="text"
                                                   title="家长姓名"
                                                   class="form-control" value="${data.name}"/>
                                        </label>
                                        <label>
                                            <select name="affiliationRelation">
                                                <@dictionary groupCode="affiliationRelation";dics>
                                                <#list dics as dic>
                                                    <option value="${dic.code}">${dic.value}</option>
                                                </#list>
                                            </@dictionary>
                                            </select>
                                        </label>
                                        <!--<label>-->
                                        <!--<select name="profession">-->
                                        <!--<@dictionary groupCode="profession";dics>-->
                                        <!--<#list dics as dic>-->
                                        <!--<option value="${dic.code}">${dic.value}</option>-->
                                        <!--</#list>-->
                                        <!--</@dictionary>-->
                                        <!--</select>-->
                                        <!--</label>-->
                                        <label>
                                            <div class="circle">
                                            </div>
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </#if>
                        <#list relationList as data>
                            <#if (true && editModel=='add')||(true && editModel=='edit')>
                                <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-20 ">
                                    <input type="hidden" name="relationId" value="${data.id}">
                                    <div class="form-group">
                                        <label for="contactPhone"
                                               class="col-sm-2 col-sm-offset-2 control-label no-padding-right">家长姓名</label>
                                        <div class="col-sm-6">
                                            <input data-bv-message="The field is not valid" size="11"
                                                   name="patriarchName" alt="联系电话" id="patriarchName" placeholder="家长姓名"
                                                   type="text" title="家长姓名" class="form-control" value="${data.name}"/>
                                            <input data-bv-message="The field is not valid" size="11"
                                                   name="affiliationRelation" alt="所属关系" id="affiliationRelation"
                                                   placeholder="所属关系" type="text" title="所属关系" class="form-control"
                                                   value="${data.affiliationRelation}"/>
                                            <input data-bv-message="The field is not valid" size="11" name="profession"
                                                   alt="职业" id="profession" placeholder="职业" type="text" title="职业"
                                                   class="form-control" value="${data.profession}"/>
                                            <span class="text"></span>
                                        </div>
                                    </div>
                                </div>
                            </#if>
                        </#list>
                    </#if>
                    <#if (true && editModel=='add')||(true && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-20">
                            <div class="form-group">
                                <label for="contactPhone"
                                       class="col-sm-2 col-sm-offset-2 control-label no-padding-right"><span
                                        style="color: red">*</span>联系电话：</label>
                                <div class="col-sm-6">
                                    <input data-bv-message="The field is not valid" size="11" name="contactPhone"
                                           alt="联系电话" id="contactPhone" placeholder="联系电话" type="text" title="联系电话"
                                           class="form-control" value="${editEntity.contactPhone}"/>
                                    <span class="text"></span>
                                </div>
                            </div>
                        </div>
                    </#if>
                    <#if (false && editModel=='add')||(false && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-20">
                            <div class="form-group">
                                <label for="channelSource"
                                       class="col-sm-2 col-sm-offset-2 control-label no-padding-right">客户来源</label>
                                <div class="col-sm-6">
                                    <input data-bv-integer-message="The field is number"
                                           data-bv-message="The field is not valid" data-bv-integer="true" size="11"
                                           name="channelSource" alt="客户来源" id="channelSource" placeholder="学员渠道id"
                                           type="text" title="客户来源" class="form-control"
                                           value="${editEntity.channelSource}"/>
                                    <span class="text"></span>
                                </div>
                            </div>
                        </div>
                    </#if>
                    <#if (false && editModel=='add')||(false && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-20">
                            <div class="form-group">
                                <label for="demanDegree"
                                       class="col-sm-2 col-sm-offset-2 control-label no-padding-right">需要程度</label>
                                <div class="col-sm-6">
                                    <input data-bv-integer-message="The field is number"
                                           data-bv-message="The field is not valid" data-bv-integer="true" size="11"
                                           name="demanDegree" alt="需要程度" id="demanDegree" placeholder="需要程度" type="text"
                                           title="需要程度" class="form-control" value="${editEntity.demanDegree}"/>
                                    <span class="text"></span>
                                </div>
                            </div>
                        </div>
                    </#if>
                    <#if (true && editModel=='add')||(true && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-20">
                            <div class="form-group">
                                <label for="contactPhone"
                                       class="col-sm-2 col-sm-offset-2 control-label no-padding-right">所属顾问：</label>
                                <div class="col-sm-6">
                                    <select name="memberStaffId" id="adminUserId" class="col-sm-12">
                                    </select>
                                </div>
                            </div>
                        </div>
                    </#if>



                    <#if memberType==1||memberType==2>
                        <div class="col-sm-12 text-align-center margin-bottom-30">
                            <button class="btn btn-blue" style="width:80px;margin-right:20px;"
                                    onclick="studentAddShowDialog(this)">下一步
                            </button>
                            <input type="button" style="width:80px;" class="btn btn-blue" data-dismiss="modal"
                                   value="取消"
                                   />
                        </div>
                    </#if>

                    <#if memberType==0>
                        <div class="col-sm-12">
                            <input type="button" class="btn btn-default" data-dismiss="modal" value="取消"
                                   />
                            <button type="submit" class="btn btn-blue" id="editFormSubmitBtn_${serializeNum}">保存
                            </button>
                        </div>
                    </#if>
                </div>


                <div class="ancedInfo" style="display: none">
                    <#if (true && editModel=='add')||(true && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-20">
                            <div class="form-group">
                                <label for="contactPhone"
                                       class="col-sm-2 col-sm-offset-2 control-label no-padding-right">会员来源：</label>
                                <div class="col-sm-6">
                                    <select name="" class="col-sm-12">
                                        <option value="">网络</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </#if>

                    <#if (true && editModel=='add')||(true && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-20">
                            <div class="form-group">
                                <label for="weiChat"
                                       class="col-sm-2 col-sm-offset-2 control-label no-padding-right">微信号：</label>
                                <div class="col-sm-6">
                                    <input data-bv-message="The field is not valid" size="20" name="weiChat"
                                           alt="微信号"
                                           id="weiChat" placeholder="微信号" type="text" title="微信号"
                                           class="form-control"
                                           value="${editEntity.weiChat}"/>
                                    <span class="text"></span>
                                </div>
                            </div>
                        </div>
                    </#if>
                    <#if (true && editModel=='add')||(true && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-20">
                            <div class="form-group">
                                <label
                                        class="col-sm-2 col-sm-offset-2 control-label no-padding-right">所属城区：</label>
                                <div class="col-sm-6">
                                    <select name="addressProvince" class="addressProvince col-sm-12">
                                        <!-- <option value="0">北京</option>-->
                                    </select>

                                    <select name="addressCity" class="addressCity col-sm-12">
                                        <!-- <option value="0">朝阳区</option>-->
                                    </select>
                                    <select name="addressRegion" class="addressRegion col-sm-12">
                                        <!-- <option value="0">朝阳区</option>-->
                                    </select>
                                </div>
                            </div>
                        </div>
                    </#if>


                    <#if (true && editModel=='add')||(true && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-20">
                            <div class="form-group">
                                <label for="familyAddress"
                                       class="col-sm-2 col-sm-offset-2 control-label no-padding-right">家庭住址：</label>
                                <div class="col-sm-6">
                                    <input data-bv-message="The field is not valid" size="50" name="familyAddress"
                                           alt="家庭住址" id="familyAddress" placeholder="家庭住址" type="text" title="家庭住址"
                                           class="form-control" value="${editEntity.familyAddress}"/>
                                    <span class="text"></span>
                                </div>
                            </div>
                        </div>
                    </#if>


                    <#if (true && editModel=='add')||(true && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-20">
                            <div class="form-group">
                                <label for=""
                                       class="col-sm-2 col-sm-offset-2 control-label no-padding-right">备注：</label>
                                <div class="col-sm-6">
                                    <textarea class="form-control" name="remark" rows="2" style="resize:none"></textarea>
                                </div>
                            </div>
                        </div>
                    </#if>
                    <div class="col-sm-12 text-align-center margin-bottom-30">
                        <button type="submit" class="btn btn-blue" style="width: 80px;margin-right: 20px"
                                id="editFormSubmitBtn_${serializeNum}">确定
                        </button>
                        <input type="button" style="width:80px;" class="btn btn-blue"
                               value="取消"
                               />
                    </div>

                </div>
                <div class="package" style="display: none">
                    <#if (true && editModel=='add')||(true && editModel=='edit')>
                        <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-20 margin-top-20">
                            <div class="form-group">
                                <label for="contractNumber"
                                       class="col-sm-3 col-sm-offset-1 control-label no-padding-right">合同编号：</label>
                                <div class="col-sm-6">
                                    <input data-bv-message="The field is not valid" size="50" name="contractNumber" alt="合同编号"
                                           id="contractNumber" placeholder="合同编号" type="text" title="合同编号" class="form-control"
                                           value="${editEntity.contractNumber}"/>
                                    <span class="text"></span>
                                </div>
                            </div>
                        </div>
                    </#if>
                    <#if (true && editModel=='add')||(true && editModel=='edit')>
                        <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-20">
                            <div class="form-group">
                                <label class="col-sm-3 col-sm-offset-1 control-label no-padding-right">课时包名称：</label>
                                <div class="col-sm-6">
                                    <select name="packageId"  id="packageId" class="col-sm-12" onchange="packageCheck(this)">

                                    </select>
                                </div>
                            </div>
                        </div>
                    </#if>
                    <#if memberType==2>
                        <#if (true && editModel=='add')||(false && editModel=='edit')>
                            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-20">
                                <div class="form-group">
                                    <label for="attendanceDay"
                                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right">可出勤天数</label>
                                    <div class="col-sm-6">
                                        <input data-bv-integer-message="The field is number"
                                               data-bv-message="The field is not valid" data-bv-integer="true" size="11"
                                               name="attendanceDay" alt="可出勤天数" id="attendanceDay"
                                               type="text" title="可出勤天数" class="form-control"
                                               value="${editEntity.attendanceDay}"/>月
                                        <span class="text"></span>
                                    </div>
                                </div>
                            </div>
                        </#if>
                    </#if>


                    <#if memberType==1>

                        <#if (true && editModel=='add')||(true && editModel=='edit')>
                            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-20">
                                <div class="form-group">
                                    <label class="col-sm-3 col-sm-offset-1 control-label no-padding-right">
                                        <span style="color: red">*</span>课时数：</label>
                                    <label class="col-sm-6">
                                        <label>
                                            <input class="form-control" type="text" style="width:60px;height: 30px!important;"
                                                   name="classHour" id="classHour" value="${editEntity.classHour}">
                                        </label>
                                        <label>
                                            课时 +
                                        </label>
                                        <label>
                                            <input class="form-control" type="text" style="width: 40px;height: 30px!important;"
                                                   name="presentClassHour" id="presentClassHour"
                                                   value="${editEntity.presentClassHour}">
                                        </label>
                                        <label>
                                            赠送课时
                                        </label>
                                    </label>
                                </div>
                            </div>
                        </#if>

                        <#if (true && editModel=='add')||(true && editModel=='edit')>
                            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-20">
                                <div class="form-group">
                                    <label for=""
                                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right">课时包原单价：</label>
                                    <div class="col-sm-6">
                                        <label>
                                            <input class="form-control" type="text" style="width:60px;height: 30px!important;"
                                                   name="originalUnitPrice" id="originalUnitPrice"
                                                   value="${editEntity.originalUnitPrice}">
                                        </label>
                                        <label>
                                            元
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </#if>

                        <#if (true && editModel=='add')||(true && editModel=='edit')>
                            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-20">
                                <div class="form-group">
                                    <label for=""
                                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right">课时包现单价：</label>
                                    <div class="col-sm-6">
                                        <label>
                                            <input class="form-control" type="text" style="width:60px;height: 30px!important;"
                                                   name="nowUnitPrice" id="nowUnitPrice" value="${editEntity.nowUnitPrice}"
                                                   onblur="calculation(this)">
                                        </label>
                                        <label>
                                            元
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </#if>


                    </#if>
                    <#if (true && editModel=='add')||(true && editModel=='edit')>
                        <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-20">
                            <div class="form-group">
                                <label for=""
                                       class="col-sm-3 col-sm-offset-1 control-label no-padding-right">课时包总价：</label>
                                <div class="col-sm-6">
                                    <label>
                                        <input class="form-control" type="text" style="width:60px;height: 30px!important;"
                                               name="sumPrice" id="sumPrice" value="${editEntity.sumPrice}">
                                    </label>
                                    <label>
                                        元
                                    </label>
                                </div>
                            </div>
                        </div>
                    </#if>
                    <#if (true && editModel=='add')||(false && editModel=='edit')>
                        <div class="col-xm-12 col-sm-6 col-lg-12">
                            <div class="form-group ">
                                <label for="dearSonValidDate"
                                       class="col-sm-3 col-sm-offset-1 control-label no-padding-right"><span
                                        style="color: red">*</span>有效期：</label>
                                <label class="col-sm-6">
                                    <label>
                                        <input class="form-control" type="text"
                                               style="width:60px;height: 30px!important;" name="dearSonValidDate"
                                               id="dearSonValidDate" value="" data-bv-field="dearSonValidDate"><i
                                            class="form-control-feedback" data-bv-field="dearSonValidDate"
                                            style="display: none;"></i>
                                    </label>
                                    <label>
                                        个月
                                    </label>
                                    <label>
                                        <button type="btn" class="btn btn-blue"
                                                style="border-color: #5db2ff!important;height:30px ;">激活
                                        </button>
                                    </label>
                                    <small class="help-block" style="">（注：激活后将从今日起开始计算有效期）</small>
                                </label>
                            </div>
                        </div>
                    </#if>

                    <#if (true && editModel=='add')||(false && editModel=='edit')>
                    <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-20">
                        <div class="form-group ">
                            <label for=""
                                   class="col-sm-3 col-sm-offset-1 control-label no-padding-right">所属顾问：</label>
                            <div class="col-sm-6">
                                <select name="" >
                                    <option value="" class="col-sm-12">
                                        王依依
                                    </option>
                                </select>

                            </div>
                        </div>
                    </div>
                    </#if>


                    <#if memberType==2>
                        <#if (true && editModel=='add')||(false && editModel=='edit')>
                            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-20">
                                <div class="form-group">
                                    <label for="nature" class="col-sm-3 col-sm-offset-1 control-label no-padding-right">课时包性质</label>
                                    <div class="col-sm-6">

                                        <label class="margin-right-20">
                                            <input type="radio" name="nature" value="1" checked="checked">
                                            <span class="text" style="margin-top:6px"> 全日</span>
                                        </label>
                                        <label>
                                            <input type="radio" name="nature" value="2">
                                            <span class="text" style="margin-top:6px">半日</span>
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </#if>
                    </#if>

                    <#if (true && editModel=='add')||(true && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-20">
                            <div class="form-group">
                                <label for="" class="col-sm-2 col-sm-offset-2 control-label no-padding-right">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注：</label>
                                <div class="col-sm-6">
                                    <textarea class="form-control" name="remark" rows="2" style="resize:none"></textarea>
                                </div>
                            </div>
                        </div>
                    </#if>
                    <div class="col-sm-12 text-align-center margin-bottom-30">
                        <input type="button" class="btn btn-blue" style="width: 80px;margin-right: 20px" value="取消"
                               onclick="packageBack(this)"/>
                        <button type="submit" class="btn btn-blue" style="width: 80px;" onclick="packageAdd()"
                                id="editFormSubmitBtn_${serializeNum}">保存
                        </button>
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>
<script src="assets/js/validation/bootstrapValidator_init.js"></script>
<script>
    //获取顾问信息
    function ajaxStaffList() {
        ajaxRequest("sysAdminUserController/getPostListByDuty.do",{
            duty:1
        }, function (result) {
            var data=result.data;
            var arr=['<option value="0">请选择</option>'];
            for (var i = 0; i< data.length; i++) {
                arr.push('<option value="'+data[i].id+'">'+data[i].realName+'</option>')
            }
            $("#adminUserId").html(arr.join(''))
        },function(){
            ajaxError("加载员工信息失败");
        }, "post","json")
    }
    $(function(){
        ajaxStaffList();
        ajaxProvinceList();
        var memberType=$(".memberType").val();
        ajaxPackageList(memberType);
    });

    /**
     * 获取省
     */
    function ajaxProvinceList() {
        ajaxRequest("sysCitysController/provinceList.do", null, function (result) {
            var data = result.data;
            var arr = ['<option value="0">请选择</option>'];
            $.each(data, function (i, t) {
                arr.push('<option value="' + t.id + '">' + t.name + '</option>')
            })
            $(".addressProvince").html(arr.join(''))
        }, function () {
            ajaxError("加载城市失败");
        }, "get", "json")
    }

    /**
     * 获取市
     */
    $(".addressProvince").change(function () {
        var nowSelectedProvince = $(this).val();
        ajaxRequest("sysCitysController/getChildrens.do", {
            pId: nowSelectedProvince
        }, function (result) {
            var data = result.data;
            var arr = ['<option value="0">请选择</option>'];
            $.each(data, function (i, t) {
                arr.push('<option value="' + t.id + '">' + t.name + '</option>')
            })
            $(".addressCity").html(arr.join(''))

        }, function () {
            ajaxError("加载城市失败")
        }, "get", "json")
    });


    /**
     * 获取区
     */
    $(".addressCity").change(function () {
        var nowSelectedProvince = $(this).val();
        ajaxRequest("sysCitysController/getChildrens.do", {
            pId: nowSelectedProvince
        }, function (result) {
            var data = result.data;
            var arr = ['<option value="0">请选择</option>'];
            $.each(data, function (i, t) {
                arr.push('<option value="' + t.id + '">' + t.name + '</option>')
            })
            $(".addressRegion").html(arr.join(''))

        }, function () {
            ajaxError("加载城市失败")
        }, "get", "json")
    });

    function ajaxPackageList(type) {
        ajaxRequest("tssPackageController/ajaxPackageListByType.do", {
            type: type
        }, function (result) {
            var data = result.data;
            var arr=['<option value="0">请选择</option>'];
            if (type == 1) {
                for (var i = 0; i < data.length; i++) {
                    arr.push('<option  value="' + data[i].id + '" packageId="' + data[i].id + '" packageOriginalUnitPrice="' + data[i].originalUnitPrice + '" packageValidDate="' + data[i].validDate + '" packageTotalClassHour="' + data[i].totalClassHour + '" packageSumPrice="' + data[i].sumPrice + '">' + data[i].name + '</option>')
                }
                $('#packageId').html(arr.join(''));
            } else {
                for (var i = 0; i < data.length; i++) {
                    arr.push('<option  value="' + data[i].id + '" packageId="' + data[i].id + '" packageAttendanceDay="' + data[i].attendanceDay + '" packageValidDate="' + data[i].validDate + '" packageSumPrice="' + data[i].sumPrice + '" >' + data[i].name + '</option>')
                }
                $('.packageId').html(arr.join(''));
            }
        }, function () {
            ajaxError("加载课程包失败")
        }, "get", "json")
    }


    /**
     * 选择课时包
     * @param that
     */
    function packageCheck(that) {
        var id = $(that).attr("id");
        if (id == 'packageId') {
            var packageId = $("#packageId").find("option:selected").attr("packageId");
            var packageOriginalUnitPrice = $("#packageId").find("option:selected").attr("packageOriginalUnitPrice");
            var packageValidDate = $("#packageId").find("option:selected").attr("packageValidDate");
            var packageTotalClassHour = $("#packageId").find("option:selected").attr("packageTotalClassHour");
            var packageSumPrice = $("#packageId").find("option:selected").attr("packageSumPrice");

            $('input[name="nowUnitPrice"]').val(packageOriginalUnitPrice);
            $('input[name="sumPrice"]').eq(0).val(packageSumPrice);
            $('input[name="classHour"]').eq(0).val(packageTotalClassHour);
            $('input[name="originalUnitPrice"]').eq(0).val(packageOriginalUnitPrice);
            $('input[name="dearSonValidDate"]').eq(0).val(packageValidDate);
        } else {
            var packageId = $("#packageId").find("option:selected").attr("packageId");
            var packageAttendanceDay = $("#packageId").find("option:selected").attr("packageAttendanceDay");
            var packageSumPrice = $("#packageId").find("option:selected").attr("packageSumPrice");
            var packageValidDate = $("#packageId").find("option:selected").attr("packageValidDate");


            $('input[name="attendanceDay"]').eq(0).val(packageAttendanceDay);
            $('input[name="sumPrice"]').eq(0).val(packageSumPrice);
            $('input[name="validDate"]').eq(0).val(packageValidDate);


        }
    }


    /**
     * 家长信息添加与删除
     */
    var html = '<div class="form-group has-feedback">' +
        '<label class="col-sm-8 col-sm-offset-4">' +
        '<label>' +
        '<input required="required" data-bv-message="请填写客户信息！" maxlength="12"' +
        'name="patriarchName"' +
        'alt="联系电话"  placeholder="家长姓名" type="text"' +
        'title="家长姓名"' +
        'class="form-control" value="${data.name}"/>' +
        '</label>&nbsp;' +
        '<label>' +
        '<select name="affiliationRelation">' +
        '<@dictionary groupCode="affiliationRelation";dics>' +
        '<#list dics as dic>' +
        '<option value="${dic.code}">${dic.value}</option>' +
        '</#list>' +
        '</@dictionary>' +
        '</select>' +
        '</label>&nbsp;' +
        '<label>' +
        '<div class="circle1">' +
        '</div>' +
        '</label>' +
        '</label>' +
        '</div>';

    $('.circle').click(function () {
        $('.circleHtml').append(html);
    });

    $(".circleHtml").click(function (e) {
        if (e.target.className == "circle1") {
            $(e.target).parents(".form-group").remove();
        }
        ;
    });


    $(".selectpicker_${serializeNum}").select2();

    function studentAddShowDialog(that) {
        $(".member").css('display', 'none');
        $(".package").css('display', 'block');
        $(".modal-title").html("购买亲子课时包");
        $(".modalTitle").addClass("hidden");
    }

    function packageBack(that) {
        $(".member").css('display', 'block');
        $(".package").css('display', 'none');
        $(".modal-title").html("新增亲子会员");
        $(".modalTitle").removeClass("hidden").addClass("show");
    }

    $(".basicInfoBtn").click(function () {
        $('.basicInfoBtn').css("background","#5db2ff");
        $('.ancedInfoBtn').css("background","#fff");
        $(".member").css('display', 'block');
        $(".package").css('display', 'none');
        $(".ancedInfo").css('display','none');

    })
    $(".ancedInfoBtn").click(function () {
        $('.ancedInfoBtn').css("background","#5db2ff");
        $('.basicInfoBtn').css("background","#fff");
        $(".member").css('display', 'none');
        $(".package").css('display', 'none');
        $(".ancedInfo").css('display','block');
    })

    function packageAdd() {

    }
</script>